<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改密码</title>
    <link href="css/bootstrap.css" rel="stylesheet">
    <!-- Theme Styles -->
    <link href="css/ecaps.min.css" rel="stylesheet">
    <script type="text/javascript" src="js/jquery.js"></script>
</head>
<body>
<div class="page-inner">
    <p class="headpic">
        <img src="images/myinfo_img/portrait.jpg" height="150" width="150" align="middle">
    </p>
    <div id="main-wrapper">
        <div class="row">
            <div class="col-md-6 col-md-offset-3">
                <div class="panel panel-white" style="background-color: rgb(225,219,159)">
                    <div class="panel-body">
                        <form class="form-horizontal" id="myInfo" method="post" action="#">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">旧 &nbsp 密&nbsp 码 :</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="oldpw" placeholder="请旧密码" value="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">新 &nbsp 密&nbsp 码 :</label>
                                <div class="col-sm-10">
                                    <input type="password" class="form-control" id="newpw" placeholder="请输入新密码" value="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">确认新密码 :</label>
                                <div class="col-sm-10">
                                    <input type="password" class="form-control" id="comfirpw" placeholder="请确认新密码" value="">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <button type="button" class="btn popver-show" id="handup"
                                            data-toggle="modal" data-target="#myModalCheck"
                                            style="margin-top:10px;margin-bottom:-14px;" onclick="modify()">提 交
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function modify() {
        var oldPassword = $("#oldpw").val();
        var newPassword = $("#newpw").val();
        var comfirPassword = $("#comfirpw").val();
        var data={
            "oldPassword":oldPassword,
            "newPassword":newPassword,
            "comfirPassword":comfirPassword
        };
        $.ajax({
            url: "http://www.longm.top:8080/lm/ModifyPassword",
            type: "post",
            dataType: 'json',
            headers:{
                'Content-Type':'application/json',
                "token":window.localStorage.getItem("token")
            },
            data: JSON.stringify(data),
            contentType: "application/x-www-form-urlencoded",
            success: function (result) {
                console.log(JSON.stringify(result));
                if (result.code === 200) {
                    alert(result["data"]);
					window.location.href = "modifypw.html";
                } else {
                    alert(result["data"]);
                }
            }
        });
    }
</script>
</body>
</html>